#include "threadPool.hpp"
#include "Task.hpp"
#include <ctime>


int main()
{
    srand(time(nullptr)^getpid());
    ThreadPool<Task> *tp=new ThreadPool<Task>(5);
    tp->Start();
    while(true)
    {
        //1.构建数据
        int x=rand()%10+1;
        usleep(10);
        int y=rand()%5;
        char op=opers[rand()%opers.size()];
        Task task(x,y,op);
        tp->Push(task);
        //2.交给线程池处理
        std::cout<<"main thread made a task, "<<task.GetTask() << std::endl;
        sleep(1);
    }
    return 0;
}